<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)){ 
	session_start(); 
}
if(!isset($_SESSION['user'])){
	echo "timeout";
}else{
	if(isset($_REQUEST['nfid'])){
		$idpro=$_REQUEST['nfid'];
		include '../operations/connection.php';
		set_time_limit(0);
		$sql="SELECT nf.nf_title,nf.nf_content from pr_newfunction nf where nf.nfid='".$idpro."'";
		$listattach = mysql_query('select id, testprojectid, filepath, filereal, filename, filetype, filesize, createdate from pre_attach where testprojectid='.$_REQUEST['nfid']);
		$q=mysql_query($sql);
		$t='';
		$n='';
		while($r=mysql_fetch_array($q)){
			$t=stripslashes($r['nf_title']);
			$n=stripslashes($r['nf_content']);
		}
		?>
		<div>
			<div id="title"><?=$t?></div>
			<div id="content"><?=$n?></div>
		</div>
		<div>
	
	<div id='listattach'>
		<?php 
		$temindex = 0;
		while ($rowattach = mysql_fetch_array($listattach)) {?>
			<div style="padding:1px">
				<input type="hidden" id="flagattach" name="flagattach[<?=$temindex?>]]" value="true"/>
				<input type="checkbox" onclick="checkAttach(this)" style="margin:1px" checked="checked" filepath="<?=$rowattach[filepath].$rowattach[filereal]?>" />
				<a
					href="admin/attach/downloadattach.php?filepath=<?=$rowattach[filepath].$rowattach[filereal]?>&filename=<?=$rowattach[filename]?>&filetype=<?=$rowattach[filetype]?>">
					<?=$rowattach[filename]."(".$rowattach[filetype].") ".$rowattach[filesize]?></a>
				<input type="hidden" name="attachpath[<?=$temindex?>]" value="<?=$rowattach[filepath]?>" />
				<input type="hidden" name="attachreal[<?=$temindex?>]" value="<?=$rowattach[filereal]?>" />
				<input type="hidden" name="attachfile[<?=$temindex?>]" value="<?=$rowattach[filename]?>" />
				<input type="hidden" name="attachtype[<?=$temindex?>]" value="<?=$rowattach[filetype]?>" />
				<input type="hidden" name="attachsize[<?=$temindex?>]" value="<?=$rowattach[filesize]?>" />
				<input type="hidden" name="attachid[<?=$temindex?>]" value="<?=$rowattach[id]?>"/>
			</div>
		<?php $temindex+=1;}
		?>
	</div>
</div>
		<?php 
		mysql_close($connection);
	}
}
?>
